package cn.liwq.demo.java.raw.proxy.entry.impl;

import cn.liwq.demo.java.raw.proxy.entry.Foo;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

/**
 * <p>Project: demo-common </p>
 * 
 * <p>Function:  </p>
 * 
 * <p>Description:  </p>
 * 
 * <p>Copyright: Copyright(c) 2018 Ucarinc </p>
 * 
 * <p>Company: Ucarinc </p>
 * 
 * @author weiqiang.li@ucarinc.com
 * 
 * @date 2018-08-15 17:17:11
 * 
 * @version 1.0
 */
public class FooA implements Foo {
    @Override
    public String print(String msg) {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(msg);
        return "success";
    }

    @Override
    public boolean doSomething(String param) {
        Objects.requireNonNull(param);
        char[] chars = param.toCharArray();
        StringBuffer buffer = new StringBuffer(param.length());
        for (int i = param.length()-1; i >= 0 ; i--) {
            buffer.append(chars[i]);
        }
        System.out.println("reverse : " + buffer.toString());
        return true;
    }
}
